<p>Tabbing focus into the bottom input should not trigger duplicate focus events for both inputs.</p>
<input type="text" id="x"><br>
<input type="text" id="y">
<pre id="log">
Expected:
Top Input: Focus Event #1
Bottom Input: Focus Event #1
Top Input: Focus Event #2

Actual:
</pre>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

function log(s) {
    document.getElementById('log').appendChild(document.createTextNode(s+"\n"));
}

var topInput = document.getElementById('x');
var topCounter = 0;
var bottomInput = document.getElementById('y');
var bottomCounter = 0;

topInput.addEventListener('focus', function() {
    ++topCounter;
    log("Top Input: Focus Event #" + topCounter);
}, false);

bottomInput.addEventListener('focus', function() {
    ++bottomCounter;
    log("Bottom Input: Focus Event #" + bottomCounter);
    topInput.focus();
}, false);

topInput.focus();
if (window.eventSender)
    eventSender.keyDown('\t');
</script>
